package com.tbit.uqbike.object.pojo.vo;

import com.tbit.uqbike.annos.Excel;
import com.tbit.uqbike.constant.CardTypeConstant;
import com.tbit.uqbike.constant.CsvConstant;
import com.tbit.uqbike.object.pojo.CardUseLog;
import com.tbit.uqbike.webmanager.util.csv.annotations.Csv;
import lombok.Data;

/**
 * 卡券使用记录返回实体类
 *
 * @Author:BUGTian
 * @DATE: 2023/1/6
 */
@Data
public class CardUseLogVO extends CardUseLog {
    /**
     * 购买区域名称
     */
    @Excel(name = "购买区域", sort = 1)
    @Csv(name = "购买区域", type = CsvConstant.CSV_TYPE_WITHOUT)
    private String buyAccountName;
    /**
     * 使用区域名称
     */
    @Excel(name = "使用区域", sort = 2)
    @Csv(name = "使用区域", type = CsvConstant.CSV_TYPE_WITHOUT)
    private String useAccountName;
    /**
     * 卡券类型解析
     */
    @Excel(name = "卡券类型", sort = 6)
    @Csv(name = "卡券类型", type = CsvConstant.CSV_TYPE_WITHOUT)
    private String cardTypeName;
    /**
     * 金额 (单位:元)
     */
    @Excel(name = "金额", sort = 7)
    @Csv(name = "金额", type = CsvConstant.CSV_TYPE_WITHOUT)
    private Double moneyYuan;

    public Double getMoneyYuan() {
        return money == 0 ? 0D : (double) money / 100;
    }

    public String getCardTypeName() {
        String name = null;
        switch (cardType) {
            case CardTypeConstant.MEM:
                name = CardTypeConstant.MEM_NAME;
                break;
            case CardTypeConstant.RIDE_CARD:
                name = CardTypeConstant.RIDE_CARD_NAME;
                break;
            case CardTypeConstant.VIP:
                name = CardTypeConstant.VIP_NAME;
                break;
            case CardTypeConstant.MEAL:
                name = CardTypeConstant.MEAL_NAME;
                break;
            default:
                name = "";
        }
        return name;
    }
}
